<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('确认发货')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-order-edit" th:object="${shopOrder}">
            <input name="id" th:field="*{id}" type="hidden">
            <input type="hidden" name="orderStatus" value="2">
            <div class="form-group">    
                <label class="col-sm-3 control-label">物流：</label>
                <div class="col-sm-8">
                   <select name="expressId" id="expressId" class="form-control m-b" required>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">物流单号：</label>
                <div class="col-sm-8">
                    <input name="expressNum" th:field="*{expressNum}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "shop/order";
        getExpressId();
        $("#form-order-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-order-edit').serialize());
            }
        }
        function getExpressId() {
			document.getElementById("expressId").options.length = 0;
			$.ajax({
				type : "post",
				url : "/shop/order/getExpress",
				dataType : "json",
				success : function(data) {
					var html = "<option value=''>所有</option>";
					for (var i = 0; i < data.length; i++) {
						html += '<option value="' + data[i].id + '">'
								+ data[i].express + '</option>'
					}
					$("#expressId").append(html);
				}
			});
		}
    </script>
</body>
</html>